<?php 
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header2', 'admin');
?>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8"/>
<title>Metronic | Form Stuff - Form Layouts</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta content="" name="description"/>
<meta content="" name="author"/>
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<!--
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css"/>
-->
<link href="<?php echo CSS_PATH?>metronic/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo CSS_PATH?>metronic/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo CSS_PATH?>metronic/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo CSS_PATH?>metronic/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo CSS_PATH?>metronic/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css"/>
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN PAGE LEVEL STYLES -->
<link rel="stylesheet" type="text/css" href="<?php echo CSS_PATH?>metronic/select2/select2.css"/>
<!-- END PAGE LEVEL SCRIPTS -->
<!-- BEGIN THEME STYLES -->
<link href="<?php echo CSS_PATH?>metronic/components.css" id="style_components" rel="stylesheet" type="text/css"/>
<link href="<?php echo CSS_PATH?>metronic/plugins.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo CSS_PATH?>metronic/layout.css" rel="stylesheet" type="text/css"/>
<link id="style_color" href="<?php echo CSS_PATH?>metronic/darkblue.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo CSS_PATH?>metronic/custom.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo CSS_PATH?>select_xiala.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo CSS_PATH?>table_form.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="<?php echo JS_PATH?>calendar/jscal2.css"/>
<link rel="stylesheet" type="text/css" href="<?php echo JS_PATH?>calendar/border-radius.css"/>
<link rel="stylesheet" type="text/css" href="<?php echo JS_PATH?>calendar/win2k.css"/>
<script type="text/javascript" src="<?php echo JS_PATH?>calendar/calendar.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH?>calendar/lang/en.js"></script>
<script src="<?php echo JS_PATH?>PCASClass.js"></script>
<!-- END THEME STYLES -->
<link rel="shortcut icon" href="favicon.ico"/>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="page-header-fixed page-quick-sidebar-over-content ">
<!-- BEGIN HEADER -->
<!-- BEGIN CONTAINER -->
<div class="page-container">
	<!-- BEGIN CONTENT -->
	<div class="page-content-wrapper">
		<div>
			<!-- BEGIN PAGE CONTENT-->
			<div class="row">
				<div class="col-xs-2">
					<div class="tabbable-line boxless tabbable-reversed">
						<div class="tab-content">
								<div style="background-color: #5a99fb;padding: 9px;color: white;">
									
										<h1 class="text-center"><?php echo $patients_data['patient_name']?></h1><br>
										<p class="text-center">
											<?php echo $patients_data['sex']?>
											<?php echo $patients_data['age']?>
											<?php echo $patients_data['address']?>
										</p>
										<p class="text-center">
											<h>电话：</h>
											<?php echo $patients_data['phone']?>
										</p>
										<p class="text-center">
											<h>档案号：</h><?php echo $patients_data['archives_num']?>
										</p>		
									
								</div>
								<?php if(is_array($medical_record_data)){foreach($medical_record_data as $v){?>  
								<p class='text-center' style="background-color: #e2e8f7;padding: 13px;margin-top: 4px;border-radius: 6px !important;">
									<a style="color:black" href="javascript:editRecord('<?php echo $v['id']?>')"><?php echo $v['clinic_time']?></a>
								</p>
										
								<?php }} ?>
								<p class='text-center' style="background-color: #e2e8f7;padding: 13px;margin-top: 4px;border-radius: 6px !important;">
										<a style="color:black;" href="javascript:addRecord('<?php echo $id?>')" >添加病历</a>
								</p>
									
								
														
						</div>
					</div>
				
				</div>
				<div class="col-xs-10">
					<div class="tabbable-line boxless tabbable-reversed">
						<div class="tab-content">
							
							<div class="tab-pane active" id="tab_0">	
									<div class="portlet-body form">
										<!-- <h><strong>编辑病人信息：</strong></h> -->
										<!-- BEGIN FORM-->
										<form name="myform" action="?m=admin&c=boneDatabase&a=patients_editdo" method="post" id="myform" class="form-horizontal">
											<div class="form-body">
											<h><strong>编辑病人信息：</strong></h>
											<h3 style="float:right;">
												<a href="/boneDatabase/index.php?m=admin&c=boneDatabase&a=patients_info">回到主页</a>
											</h3>
											</div>
											<div class="form-body">
												<div class="col-xs-5">
                                                    <div class="form-group">
                                                        <label class="col-xs-12 pullleft">

                                                            <label class="col-xs-12 pullleft">医院号</label>
                                                            <select name="hospital_id" id="hospital_num"  class="selectadd"  >
                                                                <option value="" selected="">请选择</option>
                                                                <?php if(is_array($hospital_data) ){foreach($hospital_data as $v){?>
                                                                    <option value="<?php echo $v['hospitalnum'] ?>" <?php if($patients_data['hospital_id'] == $v['hospitalnum']){ echo 'selected';}?> >
                                                                        <?php echo $v['hospitalnum'] ?>
                                                                    </option>
                                                                <?php }} ?>
                                                            </select>
                                                        </label>

                                                    </div>
													<div class="form-group">
														<label class="col-xs-12 pullleft">档案号</label>
														<div class="col-xs-12">
															<input type="text" name="archives_num"  class="form-control input-circle" value="<?php echo $patients_data['archives_num']?>" disabled="">
														</div>
													</div>
													<div class="form-group">
														<label class="col-xs-12 pullleft">姓名</label>
														<div class="col-xs-12">
															<input type="text" name="patient_name" id="patient_name"  class="form-control input-circle" value="<?php echo $patients_data['patient_name']?>">
														</div>
													</div>
													<div class="form-group">
														<label class="col-xs-12 pullleft">性别</label>
														<div class="col-xs-12">
															<select name='sex' class="selectadd" >
																<option value="男" <?php if($patients_data['sex']=='男'){ echo 'selected';}?>>男</option>
																<option value="女" <?php if($patients_data['sex']=='女'){ echo 'selected';}?>>女</option>
															</select>
														</div>
													</div>
													<div class="form-group">
														<label class="col-xs-12 pullleft">出生日期</label>
														<div class="col-xs-12">
															<input type="text" value="<?php echo $patients_data['birthday']?>" name="birthday" id="birthday" size="10" class="selectadd date" >
																<script type="text/javascript">
																	Calendar.setup({
																	weekNumbers: true,
																	inputField : "birthday",
																	trigger    : "birthday",
																	dateFormat: "%Y-%m-%d",
																	showTime: false,
																	minuteStep: 1,
																	onSelect   : function() {this.hide();}
																	});
																</script>
														</div>
													</div>
													<div class="form-group">
														<label class="col-xs-12 pullleft">联系电话</label>
														<div class="col-xs-12">
															<input type="text" name="phone" id="phone"  class="form-control input-circle" value="<?php echo $patients_data['phone']?>">
														</div>
													</div>
													<div class="form-group">
														<label class="col-xs-12 pullleft">年龄</label>
														<div class="col-xs-12">
															<input type="text" name="age"  class="form-control input-circle" value="<?php echo $patients_data['age']?>" disabled="">
															
														</div>
													</div>
												</div>										
												<div class="col-xs-5">
													<div class="form-group">
														<label class="col-xs-12 pullleft">婚姻</label>
														<div class="col-xs-12">
															<select name='marriage' class="selectadd" id="marriage" >
                                                                    <option value="">请选择</option>
																	<option value="男" <?php if($patients_data['marriage']=='已婚'){ echo 'selected';}?> >已婚</option>
																	<option value="女" <?php if($patients_data['marriage']=='未婚'){ echo 'selected';}?> >未婚</option>
															</select>
														</div>
													</div>
													<div class="form-group">
														<label class="col-xs-12 pullleft" >民族</label>
														 <select id="national" name='nation' class="selectadd" style="margin-left: 13px;width: 94%;">
	    												</select>	
													</div>
													<div class="form-group">
														<label class="col-xs-12 pullleft">出生地</label>
														 	<select name="province" value="" class="selectadd" style="margin-left: 13px;width: 26%;"></select>
														 	<select name="city" value="" class="selectadd" style="margin-left: 13px;width: 26%;"></select>
														 	<select name="county" value="" class="selectadd" style="margin-left: 13px;width: 26%;"></select><br>
															<script language="javascript" defer>
															
															var pro="<?php echo $patients_data['province']?>";
															var city="<?php echo $patients_data['city']?>";
															var county="<?php echo $patients_data['county']?>";
															
													
															new PCAS("province","city","county",pro.trim(),city.trim(),county.trim());
															</script>
													</div>
													<div class="form-group">
														<label class="col-xs-12 pullleft">住址</label>
														<div class="col-xs-12">
															<input type="text" name="address" id="address"  class="form-control input-circle" value='<?php echo $patients_data['address']?>'>
														</div>
													</div>
													<div class="form-group">
														<label class="col-xs-12 pullleft">职业</label>
														<div class="col-xs-12">
															<input type="text" name="job" id="job"  class="form-control input-circle" value="<?php echo $patients_data['job']?>">
														</div>
													</div>
													<div class="form-group">
														<label class="col-xs-12 pullleft">邮箱</label>
														<div class="col-xs-12">
															<input type="text" name="email" id="email"  class="form-control input-circle" value="<?php echo $patients_data['email']?>">
														</div>
													</div>
												</div>
											</div>
											<div class="form-actions">
												<div class="row">
													<input type="hidden" name="id" value="<?php echo $patients_data['id']?>" />
													<div class="col-xs-offset-8 col-xs-12">
														 <button name="dosubmit" id="dosubmit" class="btn btn-circle blue" type="submit" style="width: 11%;"><?php echo L('submit')?></button>
														 <a class="btn btn-circle blue" style="width: 11%;" onclick="history.go(-1)">返回</a>
													</div>
												</div>
											</div>
										</form>
										<!-- END FORM-->
									</div>
						</div>
					</div>
				</div>
			</div>
			<!-- END PAGE CONTENT-->
		</div>
	</div>
	<h2><?php echo  $nation  ?></h2>
	<!-- END CONTENT -->
</div>
<!-- [if lt IE 9]> -->
<script src="<?php echo CSS_PATH?>metronic/respond.min.js"></script>
<script src="<?php echo CSS_PATH?>metronic/excanvas.min.js"></script> 
<!-- <![endif] -->
<!-- <script type="text/javascript" src="jquery-1.8.0.min.js"></script> -->
<script type="text/javascript">
	var nation="<?php echo  $patients_data['nation']  ?>";
	console.log(nation);
    var national = [
            "汉族", "壮族", "满族", "回族", "苗族", "维吾尔族", "土家族", "彝族", "蒙古族", "藏族", "布依族", "侗族", "瑶族", "朝鲜族", "白族", "哈尼族",
            "哈萨克族", "黎族", "傣族", "畲族", "傈僳族", "仡佬族", "东乡族", "高山族", "拉祜族", "水族", "佤族", "纳西族", "羌族", "土族", "仫佬族", "锡伯族",
            "柯尔克孜族", "达斡尔族", "景颇族", "毛南族", "撒拉族", "布朗族", "塔吉克族", "阿昌族", "普米族", "鄂温克族", "怒族", "京族", "基诺族", "德昂族", "保安族",
            "俄罗斯族", "裕固族", "乌孜别克族", "门巴族", "鄂伦春族", "独龙族", "塔塔尔族", "赫哲族", "珞巴族"
    ];
    window.onload = function ()
    {
        var nat = document.getElementById ("national");
        for ( var i = 0; i < national.length; i++)
        {
        	if (national[i] == nation){
        		var option = document.createElement ('option');
				option.setAttribute("selected", "selected");
        	}else{
            	var option = document.createElement ('option');
        	}


             option.value = national[i];
            var txt = document.createTextNode (national[i]);

            option.appendChild (txt);
            nat.appendChild (option);
        }
    }
</script>

<script src="<?php echo CSS_PATH?>metronic/jquery.min.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/jquery-migrate.min.js" type="text/javascript"></script>
<!-- IMPORTANT! Load jquery-ui.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
<script src="<?php echo CSS_PATH?>metronic/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/jquery.blockui.min.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/jquery.cokie.min.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/uniform/jquery.uniform.min.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN PAGE LEVEL PLUGINS -->
<script type="text/javascript" src="<?php echo CSS_PATH?>metronic/select2/select2.min.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="<?php echo CSS_PATH?>metronic/metronic.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/layout.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/quick-sidebar.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/demo.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/form-samples.js"></script>
<script src="<?php echo JS_PATH?>formvalidator.js"></script>
<script src="<?php echo JS_PATH?>formvalidatorregex.js"></script>
<!-- END PAGE LEVEL SCRIPTS -->
<script type="text/javascript">
	function addRecord(id){
	location.href ='?m=admin&c=boneDatabase&a=medicalRecord_add&patients_id='+id+'&pc_hash='+pc_hash+'&goback='+BASE64.encode(location.search);
	}
	function editRecord(id){
	location.href ='?m=admin&c=boneDatabase&a=medicalRecord_edit&id='+id+'&pc_hash='+pc_hash+'&goback='+BASE64.encode(location.search);

}

</script>
<script type="text/javascript" src="statics/js/base64.js"></script>
<script type="text/javascript">

jQuery(document).ready(function() {    
   // initiate layout and plugins
   Metronic.init(); // init metronic core components
Layout.init(); // init current layout
QuickSidebar.init(); // init quick sidebar
Demo.init(); // init demo features
   FormSamples.init();
});
</script>
<script type="text/javascript">
   $(document).ready(function() {
  
	$.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}});
//       $("#marriage").formValidator({onshow:"<?php //echo L('请选择').L('婚姻状况')?>//",onfocus:"<?php //echo L('请选择').L('婚姻状况')?>//"}).inputValidator({min:1,max:30,onerror:"<?php //echo L('请选择').L('婚姻状况')?>//"})

//       $("#archives_num").formValidator({onshow:"<?php //echo L('input').L('档案号')?>//",onfocus:"<?php //echo L('请输入').L('档案号')?>//"}).inputValidator({min:3,max:30,onerror:"<?php //echo L('档案号').L('3-30字符')?>//"}).ajaxValidator({
//           type : "get",
//           url : "",
//           data :"m=admin&c=boneDatabase&a=check_archives_num_ajx&patients_id=<?php //echo $patients_data['id']?>//&pc_hash=<?php //echo $_SESSION['pc_hash'];?>//",
//           datatype : "html",
//           async:'false',
//           success : function(data){
//               if( data == "1" )
//               {
//                   return true;
//               }
//               else
//               {
//                   return false;
//               }
//           },
//           buttons: $("#dosubmit"),
//           onerror : "<?php //echo L('该档案号已存在')?>//",
//           onwait : "<?php //echo L('检查中')?>//"
//
//       })


   })
</script>

<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>